<?php

/**
 * @package Framework03
 * @author Walter Tamboer
 */

/**
 * Used to debug your pages.
 */
class DebugRenderDevice extends RenderDevice
{
	/**
	 * Gets the rendered content.
	 * @return string Returns a string with the parsed content.
	 */
	public function Render()
	{
		echo '<h1>DebugRenderDevice</h1>';

		if (count($this->Data) > 0)
		{
			echo '<h2>$this->Data</h2>';
			echo '<table width="100%" border="1">';
			foreach ($this->Data as $key => $value)
			{
				echo '<tr>';
				echo '<td width="15%" valign="top">' . $key . '</td>';
				echo '<td width="85%" valign="top">';
				Utils::Debug($value);
				echo '</td>';
				echo '</tr>';
			}
			echo '</table>';
		}

		if (isset($_GET) && count($_GET) > 0)
		{
			echo '<h2>$_GET</h2>';
			echo '<table width="100%" border="1">';
			foreach ($_GET as $key => $value)
			{
				echo '<tr>';
				echo '<td width="15%" valign="top">' . $key . '</td>';
				echo '<td width="85%" valign="top">';
				Utils::Debug($value);
				echo '</td>';
				echo '</tr>';
			}
			echo '</table>';
		}

		if (isset($_POST) && count($_POST) > 0)
		{
			echo '<h2>$_POST</h2>';
			echo '<table width="100%" border="1">';
			foreach ($_POST as $key => $value)
			{
				echo '<tr>';
				echo '<td width="15%" valign="top">' . $key . '</td>';
				echo '<td width="85%" valign="top">';
				Utils::Debug($value);
				echo '</td>';
				echo '</tr>';
			}
			echo '</table>';
		}

		if (isset($_SESSION) && count($_SESSION) > 0)
		{
			echo '<h2>$_SESSION</h2>';
			echo '<table width="100%" border="1">';
			foreach ($_SESSION as $key => $value)
			{
				echo '<tr>';
				echo '<td width="15%" valign="top">' . $key . '</td>';
				echo '<td width="85%" valign="top">';
				Utils::Debug($value);
				echo '</td>';
				echo '</tr>';
			}
			echo '</table>';
		}

		if (isset($_COOKIE) && count($_COOKIE) > 0)
		{
			echo '<h2>$_COOKIE</h2>';
			echo '<table width="100%" border="1">';
			foreach ($_COOKIE as $key => $value)
			{
				echo '<tr>';
				echo '<td width="15%" valign="top">' . $key . '</td>';
				echo '<td width="85%" valign="top">';
				Utils::Debug($value);
				echo '</td>';
				echo '</tr>';
			}
			echo '</table>';
		}

		echo '<h2>$_SERVER</h2>';
		echo '<table width="100%" border="1">';
		foreach ($_SERVER as $key => $value)
		{
			echo '<tr>';
			echo '<td width="15%" valign="top">' . $key . '</td>';
			echo '<td width="85%" valign="top">';
			Utils::Debug($value);
			echo '</td>';
			echo '</tr>';
		}
		echo '</table>';
	}
}

?>